'''
Author: 红色梧桐 940120450@qq.com
Date: 2024-05-10 00:14:09
LastEditors: 红色梧桐 940120450@qq.com
LastEditTime: 2024-09-05 20:52:54
FilePath: \myReader\main.py
Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
'''
import uvicorn
from fastapi import FastAPI
import logging
import applications.configs.log

from applications.controllers import base_router
from fastapi.staticfiles import StaticFiles
from applications.middlewares import registerMiddlewareHandle
from applications.tasks import scheduler

app = FastAPI(title="综合管理平台Api", description="管理所有日常所需功能")

# 中间件
registerMiddlewareHandle(app)

# 路由
app.include_router(base_router)

# 挂载静态页面
app.mount("/static", StaticFiles(directory="static"), name="static")


if __name__ == '__main__':
    # 初始化定时任务、并添加任务
    scheduler.start()
    scheduler.print_jobs()

    # 启动服务器
    uvicorn.run(app="main:app", host="0.0.0.0", port=7563) # , reload=True